<template>
  <h1>El-单选组件</h1>
  <el-radio-group v-model="edu" class="ml-4">
    <!-- abel表示设置当前选项显示的文字,并不一定要选择单选按钮,一旦选择了某个选项,
    就会把该选项的value值保存到双向绑定的变量edu中-->
    <el-radio value="初中" label="学历:初中"></el-radio>
    <el-radio value="高中" label="学历:高中"></el-radio>
    <el-radio value="本科" label="学历:本科"></el-radio>
    <el-radio value="硕士" label="学历:硕士"></el-radio>
    <el-radio value="博士" label="学历:博士"></el-radio>
  </el-radio-group>
  <h4>你选择的学历是:{{ edu }}</h4>
  <hr>
  <el-radio-group v-model="pr" class="ml-4">
    <!-- abel表示设置当前选项显示的文字,并不一定要选择单选按钮,一旦选择了某个选项,
    就会把该选项的value值保存到双向绑定的变量edu中-->
    <el-radio-button v-for="item in data" :value="item.price" :label="item.title"></el-radio-button>
  </el-radio-group>
  <h4>你选择的价格是:{{ pr }}</h4>
</template>

<script setup>
import {ref} from "vue";

const edu = ref('本科');
const pr = ref('500');
// 准备数据:
const data = ref([
  {title:'五粮液',price:500},
  {title:'茅台',price:2500},
  {title:'梦之蓝',price:368},
  {title:'汾酒',price:330}
])
</script>

<style scoped>

</style>